/**
 * 
 */
package biz.modelx.precise.usecase.ui.model.eusecase.diagram.part;

import java.io.ByteArrayInputStream;
import java.io.InputStream;

import org.eclipse.core.resources.IStorage;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;

import remato.client.model.UseCaseDefinitionWrapper;

/**
 * @author PEide3
 *
 */
public class UseCaseModelStorage implements IStorage {
	
	private UseCaseDefinitionWrapper useCaseDefinitionWrapper;

	protected UseCaseModelStorage(UseCaseDefinitionWrapper useCaseDefinitionWrapper) {
		super();
		this.useCaseDefinitionWrapper = useCaseDefinitionWrapper;
	}

	public InputStream getContents() throws CoreException {
		return new ByteArrayInputStream(useCaseDefinitionWrapper.getDomainModelObject().getXML());
	}

	public IPath getFullPath() {
		return null;
	}

	public String getName() {
        if (useCaseDefinitionWrapper != null ) {
            return useCaseDefinitionWrapper.getText();
        }
        return null;
	}

	public boolean isReadOnly() {
		return false;
	}

	public Object getAdapter(Class adapter) {
		return null;
	}
	
}
